import axios from "axios"

const http = axios.create({
    baseURL: 'http://localhost:5000',
    // headers: { 'X-Custom-Header': 'foobar' }
});

http.interceptors.request.use(function (config) {
    // 显示loading
    return config;
}, function (error) {
    // Do something with request error
    return Promise.reject(error);
});

// Add a response interceptor
http.interceptors.response.use(function (response) {
    // 隐藏loading
    return response;
}, function (error) {
    // Any status codes that falls outside the range of 2xx cause this function to trigger
    // Do something with response error
    return Promise.reject(error);
});
export default http;